/* 库存盘点记录查看审批流程页面
 * @Author: Setsuna
 * @Email: 601890383@qq.com
 * @FilePath: \src\pages\QuotaManage\ManualInventoryRecord\List\StocksApprovalProcess.tsx
 * @Date: 2021-12-01 16:01:58
 * @LastEditTime: 2021-12-01 16:36:30
 */
import ProcessList from '@/components/ProcessList'
import React, { Component } from 'react'
import apis from '@/apis/AboutQuota'
import { http, UdDrawer } from '@/lib'
import { Empty, Spin } from 'antd'

export class StocksApprovalProcess extends Component<any> {
  state = {
    record: {},
    loading: false,
  }
  componentDidMount() {
    this.getStocksApprovalProcess()
  }
  private getStocksApprovalProcess = () => {
    this.setState({ loading: true })
    let { tradeCode: businessKey, brandCode } = this.props.record
    http
      .get(apis.getStocksApprovalProcess, {
        params: { businessKey, brandCode },
      })
      .then(res => {
        let { data } = res
        this.setState({ record: data })
      })
      .finally(() => {
        this.setState({ loading: false })
      })
  }
  render() {
    const { record } = this.state
    return (
      <Spin spinning={this.state.loading}>
        <div style={{ minHeight: 400 }}>
          {record['processDetailResult'] ? (
            <ProcessList record={record} />
          ) : (
            <Empty
              image={Empty.PRESENTED_IMAGE_SIMPLE}
              style={{ marginTop: '50%', transform: 'translate(0px, -50%)' }}
            />
          )}
        </div>
      </Spin>
    )
  }
}

export default StocksApprovalProcess
